﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public enum GameResult {
    Success,
    Fail,
}

public class Finish : MonoBehaviour {
    [Header("Binding")]
    public _EventManager _EventManager;
    public _TriggerEventManager _TriggerEventManager;
    public Button returnButton;


    // Start is called before the first frame update
    void Start() {
        _EventManager.__AttachEvent("LoadingStable", RefreshWindow);
        returnButton.onClick.AddListener(ClickReturnButton);
        InitWindow();
    }

    private void InitWindow() {
        gameObject.SetActive(false);
    }

    private void RefreshWindow(object loadingType) {
        switch ((LoadingType)loadingType) {
            case LoadingType.Finsih2Starting:
                gameObject.SetActive(false);
                break;

            case LoadingType.Gaming2Finish:
                gameObject.SetActive(true);
                break;
        }
    }

    private void SaveData() {
       //Save save = new Save(GlobalData.preSave);
       //CommonFunction.SaveData(Application.persistentDataPath + GlobalData.cloudPath + GlobalData.savePath, GlobalData.saveFileName, save);
    }

    private void ClickReturnButton() {
        _TriggerEventManager.TriggerEvent("Starting");
    }


}
